﻿using System;
using Transformable_Engine_v2.Engine.Graphics;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Super_Management_Mayhem.Content.Spritesheet.Player
{
    public class ManagerSheet : SpriteSheetInstance
    {
        protected static SpriteSheetInstance _instance;
        public static void LoadContent()
        {
            _instance = new ManagerSheet();
        }
        public new static Sprite GetSprite(Enum textureName)
        {
            return _instance.GetSprite(textureName);
        }

        public enum Indicator
        {
            ShadowIndicator,
            TileIndicator,
            FaceIndicator,
        }

        public enum IdleState
        {
            Down = 0,
            Right,
            Up,
            Left,
        }

        public enum ThrowState
        {
            Down,
            Right,
            Up,
            Left,
        }

        public enum FallState
        {
            Fall0,
            Fall1,
            Fall2,
            Fall3,
            Fall4,
            Fall5,
            Fall6,
            End
        }

        public enum Ghost
        {
            Ghost0,
            Ghost1,
            Ghost2,
            Ghost3,
        }

        #region Hit state
        public enum HitLeftState
        {
            Hurt = 0,
            Die1,
            Die2,
            Die3,
            Die4,
            Die5,
            Die6
        }

        public enum HitRightState
        {
            Hurt = 0,
            Die1,
            Die2,
            Die3,
            Die4,
            Die5,
            Die6
        }
        #endregion

        #region Walk state
        public enum WalkDownState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }
        public enum WalkDownCarryState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }

        public enum WalkRightState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }
        public enum WalkRightCarryState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }

        public enum WalkUpState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }
        public enum WalkUpCarryState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }

        public enum WalkLeftState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }
        public enum WalkLeftCarryState
        {
            Walk0 = 0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
        }
        #endregion

        #region Attack state
        public enum AttackDownState
        {
            Attack0,
            Attack1,
            Attack2,
            Attack3,
            Attack4,
        }

        public enum AttackRightState
        {
            Attack0,
            Attack1,
            Attack2,
            Attack3,
            Attack4,
            Attack5,
        }

        public enum AttackUpState
        {
            Attack0,
            Attack1,
            Attack2,
            Attack3,
            Attack4,
            Attack5,
        }

        public enum AttackLeftState
        {
            Attack0,
            Attack1,
            Attack2,
            Attack3,
            Attack4,
            Attack5,
        }
        #endregion

        #region PickupState
        public enum PickupRightState
        {
            Pickup0,
            Pickup1,
            Pickup2,
            Pickup3,
            PickupRight,
        }
        public enum PickupLeftState
        {
            Pickup0,
            Pickup1,
            Pickup2,
            Pickup3,
            PickupLeft,
        }
        public enum PickupUpState
        {
            Pickup0,
            Pickup1,
            Pickup2,
            Pickup3,
            PickupUp,
        }
        public enum PickupDownState
        {
            Pickup0,
            Pickup1,
            Pickup2,
            Pickup3,
            PickupDown,
        }
        #endregion

        public override string SpriteSheetPath
        {
            get
            {
                return "Content/Images/Player/Manager.png";
            }
        }

        protected override void LoadSprites()
        {
            AddSprite(Indicator.FaceIndicator, new TE_Rectangle(4, 1, 1, 1));

            AddEnumList<IdleState>(IdleState.Down, IdleState.Left, new TE_Rectangle(0, 0, 1, 2));

            AddEnumList<WalkDownState>(WalkDownState.Walk0, WalkDownState.Walk5, new TE_Rectangle(0, 2, 1, 2));
            AddEnumList<WalkRightState>(WalkRightState.Walk0, WalkRightState.Walk5, new TE_Rectangle(0, 4, 1, 2));
            AddEnumList<WalkUpState>(WalkUpState.Walk0, WalkUpState.Walk5, new TE_Rectangle(0, 6, 1, 2));
            AddEnumList<WalkLeftState>(WalkLeftState.Walk0, WalkLeftState.Walk5, new TE_Rectangle(0, 8, 1, 2));

            AddEnumList<AttackDownState>(AttackDownState.Attack0, AttackDownState.Attack4, new TE_Rectangle(0, 12, 2, 2));
            AddEnumList<AttackLeftState>(AttackLeftState.Attack0, AttackLeftState.Attack5, new TE_Rectangle(0, 18, 2, 2));
            AddEnumList<AttackRightState>(AttackRightState.Attack0, AttackRightState.Attack5, new TE_Rectangle(0, 14, 2, 2));
            AddEnumList<AttackUpState>(AttackUpState.Attack0, AttackUpState.Attack5, new TE_Rectangle(0, 16, 2.5f, 2));

            AddEnumList<HitRightState>(HitRightState.Hurt, HitRightState.Die6, new TE_Rectangle(0, 20, 2, 2));
            AddEnumList<HitLeftState>(HitLeftState.Hurt, HitLeftState.Die6, new TE_Rectangle(0, 22, 2, 2));

            AddEnumList<Ghost>(Ghost.Ghost0, Ghost.Ghost3, new TE_Rectangle(14, 20, 1, 2));

            AddEnumList<PickupDownState>(PickupDownState.Pickup0, PickupDownState.PickupDown, new TE_Rectangle(6, 0, 1.5f, 2));
            AddEnumList<PickupRightState>(PickupRightState.Pickup0, PickupRightState.PickupRight, new TE_Rectangle(6, 2, 1.5f, 2));
            AddEnumList<PickupUpState>(PickupUpState.Pickup0, PickupUpState.PickupUp, new TE_Rectangle(6, 4, 1.5f, 2));
            AddEnumList<PickupLeftState>(PickupLeftState.Pickup0, PickupLeftState.PickupLeft, new TE_Rectangle(6, 6, 1.5f, 2));

            AddEnumList<WalkRightCarryState>(WalkRightCarryState.Walk0, WalkRightCarryState.Walk5, new TE_Rectangle(13.5f, 0, 1, 2));
            AddEnumList<WalkDownCarryState>(WalkDownCarryState.Walk0, WalkDownCarryState.Walk5, new TE_Rectangle(13.5f, 2, 1.5f, 2));
            AddEnumList<WalkLeftCarryState>(WalkLeftCarryState.Walk0, WalkLeftCarryState.Walk5, new TE_Rectangle(13.5f, 4, 1, 2));
            AddEnumList<WalkUpCarryState>(WalkUpCarryState.Walk0, WalkUpCarryState.Walk5, new TE_Rectangle(13.5f, 6, 1.5f, 2));

            AddSprite(ThrowState.Down, new TE_Rectangle(7, 8, 1, 2));
            AddSprite(ThrowState.Right, new TE_Rectangle(8, 8, 1.5f, 2));
            AddSprite(ThrowState.Up, new TE_Rectangle(9.5f, 8, 1, 2));
            AddSprite(ThrowState.Left, new TE_Rectangle(10.5f, 8, 1.5f, 2));

            AddSprite(Indicator.TileIndicator, new TE_Rectangle(4, 0, 1, 1));
            AddSprite(Indicator.ShadowIndicator, new TE_Rectangle(5, 0, 1, 1));

            AddEnumList<FallState>(FallState.Fall0, FallState.Fall6, new TE_Rectangle(0, 10, 1.5f, 2));
            AddSprite(FallState.End, new TE_Rectangle(0, 0, 0, 0));
        }
    }
}